package IMIC.NGUYENVANTINH.OOP.LEVEL2.EX6;

public class Models {
	public boolean isEven(MyInteger myinteger) {
		if (myinteger.getNumber() % 2 == 0) {
			return true;
		} else
			return false;
	}

	public boolean isOdd(MyInteger myinteger) {
		if (myinteger.getNumber() % 2 != 0) {
			return true;
		} else
			return false;

	}

	public boolean isPrime(MyInteger myinteger) {

		if (myinteger.getNumber() < 2) {
			return false;
		} else
			for (int i = 2; i <= Math.sqrt((float) myinteger.getNumber()); i++) {
				if (myinteger.getNumber() % i == 0) {
					return false;
				}
			}
		return true;

	}

	public boolean isEven(int a) {
		if (a % 2 == 0) {
			return true;
		} else
			return false;
	}

	public boolean isOdd(int a) {
		if (a % 2 != 0) {
			return true;
		} else
			return false;

	}

	public boolean isPrime(int a) {

		if (a < 2) {
			return false;
		} else
			for (int i = 2; i <= Math.sqrt((float) a); i++) {
				if (a % i == 0) {
					return false;
				}
			}
		return true;

	}

	public boolean equals(MyInteger myinteger, int a) {
		if (myinteger.getNumber() == a) {
			return true;
		} else
			return false;
	}
}
